package com.cn.crmsystem.controller.censusController;

import com.cn.crmsystem.pojo.Login;
import com.cn.crmsystem.pojo.ResultJson;
import com.cn.crmsystem.pojo.User;
import com.cn.crmsystem.service.censusService.ForgetReminderService;
import com.cn.crmsystem.service.censusService.SalesKitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
//from ldk

@Controller
@Api(value = "仪表盘遗忘提醒的API", tags = "仪表盘遗忘提醒api")
public class ForgetReminderController {
    @Autowired
    private ForgetReminderService forgetReminderService;
    @Autowired
    private SalesKitService salesKitService;


    @RequestMapping(value = "/ForgetReminder30", method = RequestMethod.GET)
    @ResponseBody
    //first的值只有三个： myself(默认)，myselfDepartment,all
    //date有四个选择：day，month，year,
    @ApiOperation(value = "遗忘提醒的数据", notes = "展示7，15，30，90，180，360天的遗忘客户数据",
            httpMethod = "GET",
            response = ResultJson.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "firstSelect", value = "第二个下拉框的选项：传给后端的值，写四个：nowDay,nowMonth,nowYear,2020-09-07--2020-09-08 默认值为nowDay",
                    paramType = "query",
                    dataType = "String", required = false),
            @ApiImplicitParam(name = "secondSelect", value = "第一个下拉框的选项，传给后端的值，三个：myself,myDepartment,all，默认值：myself", paramType = "query",
                    dataType = "String", required = false),
    })
    public ResultJson ForgetReminder(String firstSelect, String secondSelect) {
        Login login = (Login) SecurityUtils.getSubject().getPrincipal(); //接收user类的所有属性
        Integer user_id = login.getUser_id();

//        Integer user_id=3;
        User user = salesKitService.selectUser(user_id);

        return forgetReminderService.ForgetReminderT(firstSelect, secondSelect, user);

    }
}
